unit uCanvasState;

interface

uses Graphics;

type

TCanvasState = record
    brushColor: TColor;
    fontColor: TColor;
    fontName: TFontName;
    penColor: TColor;
    penMode:  TPenMode;
    penWidth: Integer;

    procedure CopyFromCanvas(paCanvas: TCanvas);
    procedure CopyToCanvas(paCanvas: TCanvas);
end;

implementation

{ TCanvasState }

procedure TCanvasState.CopyFromCanvas(paCanvas: TCanvas);
begin
  brushColor := paCanvas.Brush.Color;
  fontColor := paCanvas.Font.Color;
  fontName := paCanvas.Font.Name;
  penColor := paCanvas.Pen.Color;
  penMode  := paCanvas.Pen.Mode;
  penWidth := paCanvas.Pen.Width;
end;

procedure TCanvasState.CopyToCanvas(paCanvas: TCanvas);
begin
  paCanvas.Brush.Color := brushColor;
  paCanvas.Font.Color := fontColor;
  paCanvas.Font.Name := fontName;
  paCanvas.Pen.Color := penColor;
  paCanvas.Pen.Mode  := penMode;
  paCanvas.Pen.Width := penWidth;
end;

end.
